<template>
  <div>
    <ChartTools class="chart">
      <template v-slot:left>
        <h3>工单统计<span class="time">{{ `${Toptime}~${Toptime}` }}</span></h3>
        <div class="left">
          <div>
            <div class="number">{{ 6 }}</div>
            <p>工单总数(个)</p>
          </div>
          <div>
            <div class="number">{{ 0 }}</div>
            <p>完成工单(个)</p>
          </div>
          <div>
            <div class="number">{{ 0 }}</div>
            <p>进行工单(个)</p>
          </div>
          <div>
            <div class="number">{{ 5 }}</div>
            <p>取消工单(个)</p>
          </div>
        </div>
      </template>
      <template v-slot:right>
        <h3>销售统计<span>{{ `${Toptime}~${Toptime}` }}</span></h3>
        <div class="right">
          <div>
            <div class="number">{{ SaleTotal.orderNum }}</div>
            <p>订单量(个)</p>
          </div>
          <div>
            <div class="number">{{ SaleTotal.cancelNum }}</div>
            <p>销售额(万元)</p>
          </div>
        </div>
      </template>
    </ChartTools>
  </div>
</template>

<script>
import { getDateStartTime, getDateEndTime, getDateEnd } from '@/utils/getTime'
import { orderCount, orderAmount } from '@/api/vm'
export default {
  data() {
    return {
      Toptime: getDateEnd(),
      time: {
        start: getDateStartTime(),
        end: getDateEndTime()
      },
      SaleTotal: {
        orderNum: 0,
        cancelNum: 0
      }
    }
  },
  async created() {
    const { data } = await orderCount(this.time)
    this.SaleTotal.orderNum = data
    const { data: data1 } = await orderAmount(this.time)
    this.SaleTotal.cancelNum = data1
  }
}
</script>

<style lang='scss' scoped>
</style>
